#!/bin/bash

cd src

echo "Making MWTurbo..."
make clean
make

if [ "$1" != "dev" ]; then
	echo "Finding current revision from http://mwturbo.googlecode.com/svn/trunk/..."
	svn_info=`svn info http://mwturbo.googlecode.com/svn/trunk/`
	regex="Revision: ([0-9]+)"

	if [[ $svn_info =~ $regex ]]; then
		clear
		echo "Parsing mwturbo.user.js ..."
		sed -i "s/\\\${REVISION}/${BASH_REMATCH[1]}/" mwturbo.user.js
	fi
fi

# Change this path to your Greasemonkey scripts MWTurbo folder for testing
mv -f mwturbo.user.js ../
